<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>嵌套for循环</title>
    <script>
        /* 嵌套for循环 */
        //向body中输出一个内容


        //通过for循环来输出图形
        //这个for外层循环执行几次，图型的高度就是多少
        //内层循环执行几次，宽度就是多少
        for (var i = 0; i < 10; i++) {
            for (var j = 0; j < i + 1; j++) {

                document.write("*" + "&nbsp;&nbsp");
            }
            document.write("<br/>");
        }

        document.write("<br/>");
        for (var n = 10; n > 0; n--) {
            for (var m = 0; m < n; m++) {

                document.write("*" + "&nbsp;&nbsp");
            }
            document.write("<br/>");
        }
        document.write("<br/>");
        for (var i = 0; i < 10; i++) {
            for (var j = 0; j < 10 - i; j++) {

                document.write("*" + "&nbsp;&nbsp");
            }
            document.write("<br/>");
        }
    </script>
</head>

<body>

</body>

</html>